package br.ufrj.neg.evento.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.tools.view.VelocityViewServlet;

import br.ufrj.neg.bean.Idioma;
import br.ufrj.neg.constants.General;
import br.ufrj.neg.evento.bean.ArtefatoBean;
import br.ufrj.neg.evento.model.ArtefatoModel;

public class ExcluirArtefatoEventoAction extends VelocityViewServlet {

	private static final long serialVersionUID = 1L;
	//private static Logger log = Logger.getLogger("rootLogger");
	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		try{
			
			String indice = request.getParameter("idArtefato");
			Idioma idioma = (Idioma) request.getAttribute("idioma");
			
			ArtefatoModel am = new ArtefatoModel();
			ArtefatoBean ab = new ArtefatoBean(idioma);
			ab.setId(Integer.parseInt(indice));
			am.removeArtefato(ab);
			
			
		}catch(Exception e){
			System.out.println(e);
			request.getRequestDispatcher(General.TELA_ERRO_500).forward(request, response);
		}
	}

}
